import service from '@/api/service'
import type { PageQuery } from '@/type/common/list-types'
import type { Page } from '@/type/User'
import { ViewDto, ViewVo } from '@/type/common/view-types'

const mapping = 'view'

export const getViewStatementApi = (viewId: string) =>
  service.get<any>(`${mapping}/statement/${viewId}`)

export const viewInfoApi = (viewId: string) =>
  service.get<any>(`${mapping}/${viewId}`)


/** 条件分页查询视图列表 */
export const viewListApi = (pageQuery: PageQuery) =>
  service.post<Page<ViewVo[]>>(`${mapping}/page`, pageQuery)

export const saveViewApi = (viewDto: ViewDto) =>
  service.put(`${mapping}`, viewDto)
